<!-- <!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // function Fn (obj) {
    //   this.say = () => {
    //   }
    //   this.name = obj.name
    //   this.age = obj.age
    // }

    // Fn.prototype.f2 = () => {
    //   console.log('构造函数原型上挂载的方法');
    // }

    // var f = new Fn({ name: 'jack', age: 18 })
    // console.log(f);

    /* 原型继承 */
    // function Father (name) {
    //   this.name = name
    // }
    // function Son (age) {
    //   this.age = age
    // }

    // var f = new Father('jack')

    // Son.prototype = f
    // var s = new Son(20)
    // console.log(s, 667);

    /* es6  class继承 */
    class Father {
      /* 构造器 */
      constructor(name, age) {
        this.name = name
        this.age = age
        this.say = () => { }
      }
    }

    class Son extends Father {
      /* 构造器 */
      constructor(name, age) {
        /* 获取父类中的数据需要使用super */
        super(name, age)
      }
    }

    var f = new Father()
    // console.log(f);

    var s = new Son()
    // console.log(Son);
  </script>
</body>

</html> -->


<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // class Animal {
    //   constructor(name) {
    //     this.name = name
    //     this.handle = () => { }
    //   }
    //   age = 18
    //   say = () => {
    //   }
    // }

    // var newAni = new Animal('jack')
    // console.log(newAni);
    /* 父类 */
    class Father {
      constructor(hobby) {
        this.hobby = hobby
      }
      name = 'jack'
    }

    const ff = new Father()
    // console.log(ff);

    /* 子类 */
    class Son extends Father {
      // constructor(s1) {
      //   super(s1)
      //   // this.gender = '男'
      // }
      age = 18
    }
    const ss = new Son(['游泳'])
    console.log(ss);
  </script>
</body>

</html>